package com.zzy.service.impl;

import com.zzy.mapper.DistrictMapper;
import com.zzy.model.District;
import com.zzy.service.DistrictService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Service//服务
@Transactional//事务
public class DistrictServiceImpl implements DistrictService {

    @Autowired
    private DistrictMapper districtMapper;

    public District getDistrictById(int id){
        District district = districtMapper.getDistrictById(id);
        String s = districtMapper.getMySqlUUID();
        return district;
    }
    public List<District> getAllDistrict(){
        List<District> list = districtMapper.getAllDistrict();
        return list;
    }

    @Override
    public List<District> getAllData() {
        List<District> list = districtMapper.getAllData();
        return list;
    }

    @Override
    public List<District> getListByParam(District obj) {
        List<District> list = new ArrayList<District>();
        list = districtMapper.getListByParam(obj);
        return list;
    }

    @Override
    public List<District> getListByPage(Map map) {
        List<District> list = new ArrayList<District>();
        list = districtMapper.getListByPage(map);
        return list;
    }

    @Override
    public District getModelById(Integer id) {
        District district = districtMapper.getDistrictById(id);
        return district;
    }

    @Override
    public District getModelByParam(District obj) {
        District district = districtMapper.getModelByParam(obj);
        return district;
    }

    @Override
    public void saveObj(District district) {
        //districtMapper.getMySqlUUID(); //获取系统id
        districtMapper.saveObj(district);
    }

    @Override
    public void updateObj(District district) {
        districtMapper.updateObj(district);
    }

    @Override
    public void deleteObjById(Integer id) {
        districtMapper.deleteObjById(id);
    }
}
